{layout name="../common/master"/}
<div id="right">
    <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">驳回认证待审核列表  <span style="font-size: 16px"> 总计：{$totalCount}</span> </h4>
    <form action="" method="get" role="form">
        <div class="form-group">
            <input type="text" style="width: 200px;float: left;margin-right: 20px" {if condition="isset($_GET['userPhone'])"} value="{$_GET['userPhone']}" {/if}  name="userPhone" id="" placeholder="用户电话">

            <label for="">短信审核状态：</label>
            <select name="sms_status" >
                <option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 11)"} selected {/if} value="11" >全部</option>
                <option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 0)"} selected {/if} value="0">未查看</option>
                <option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 1)"} selected {/if} value="1">审核通过</option>
                <option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 2)"} selected {/if} value="2">审核不通过</option>
                <option {if condition="(isset($_GET['sms_status'])) AND ($_GET['sms_status'] eq 3)"} selected {/if} value="3">无短信</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary">查询</button>
    </form>
    <button id="extend" type="submit" class="btn btn-info">导出到EXCEL</button>
    <button id="sms" type="submit" class="btn btn-primary">发送短信</button>
    <button id="app" type="submit" class="btn btn-danger">发送推送</button>
    <button id="voice" type="submit" class="btn btn-success">发送语音</button>
    <table class="table-bordered table  table-hover" style="margin-top: 20px;">
        <thead>
        <tr>
            <th>序号</th>
            <th>用户电话</th>
            <th>短信审核状态</th>
            <th>产品ID</th>
            <th>用户ID</th>
            <th>审核状态</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach name="data" item="vo" key="k"}
        {if condition="in_array($vo['user_phone_num'],$moreTwo)"}
        <tr style="color: red">
            <th>{$vo['id']}</th>
            <th>{$vo['user_phone_num']}</th>
            <th>
                {if condition="$vo['admin_sms_status'] eq 0"}
                未查看
                {elseif condition="$vo['admin_sms_status'] eq 1"}
                审核通过
                {elseif condition="$vo['admin_sms_status'] eq 2"}
                审核不通过
                {elseif condition="$vo['admin_sms_status'] eq 3"}
                无短信
                {/if}
            </th>
            <th>{$vo['product_id']}</th>
            <th>{$vo['user_id']}</th>
            <th>{$vo['check_status']}</th>
            <th>{$vo['create_time']}</th>
            <th>
                <div class="btn-group">
                    <a style="margin-left: 5px" href="{:URL('home/Check/checkinfo',['uid'=>$vo['id'],'type'=>2])}" class="btn btn-primary btn-xs">查看详情</a>
                </div>
            </th>
        </tr>
        {else/}
        <tr>
            <th>{$vo['id']}</th>
            <th>{$vo['user_phone_num']}</th>
            <th>
                {if condition="$vo['admin_sms_status'] eq 0"}
                未查看
                {elseif condition="$vo['admin_sms_status'] eq 1"}
                审核通过
                {elseif condition="$vo['admin_sms_status'] eq 2"}
                审核不通过
                {elseif condition="$vo['admin_sms_status'] eq 3"}
                无短信
                {/if}
            </th>
            <th>{$vo['product_id']}</th>
            <th>{$vo['user_id']}</th>
            <th>{$vo['check_status']}</th>
            <th>{$vo['create_time']}</th>
            <th>
                <div class="btn-group">
                    <a style="margin-left: 5px" href="{:URL('home/Check/checkinfo',['uid'=>$vo['id'],'type'=>2])}" class="btn btn-primary btn-xs">查看详情</a>
                </div>
            </th>
        </tr>
        {/if}
        {/foreach}
        </tbody>
    </table>
    {$page}

</div>
<script>
    $("#extend").click(function () {
        var url="{:URL('home/Check/checkingList',$_GET)}";
        url=url+"&extend=1";
        location.href=url;
    })

    $(".cibil").click(function () {
        var uid=$(this).attr("uid");
        var uuid=$(this).attr("uuid");
        var user_loan_id=$(this).attr("uld");
        var checkId=$(this).attr("checkId");
        $.post("{:URL('home/Check/getCriff')}",{uuid:uuid,uid:uid,user_loan_id:user_loan_id,checkId:checkId},function(res){
            if(res.code ==0){
                layer.alert(res.msg);
                location.reload();
            }else{
                layer.alert(res.msg);
                location.reload();
            }
        })
    })

    $("#sms").click(function () {
                var html=`
                <form  action="" method="post" role="form">
                        <label for="">选择短信模板</label>
                        <select name="smsTmp" id="smsTmp" class="form-control">
                        <option value=""> -- Select One --</option>
                {foreach name="smsTmp" item="vo" key="k"}
            <option value="{$vo['content']}" num="{$vo['tmp_num']}">{$vo['name']}</option>
            {/foreach}
    </select>
    </form>
    `;
    layer.open({
        btn:['发送'],
        title:'发送催款短信',
        area:['300px','300px'],
        content:html,
        yes:(function(){
            var smstmp=$("#smsTmp option:selected").val();
            var num=$("#smsTmp option:selected").attr('num');
            var phone={$phone};
            $.post("{:URL('home/Sms/onlySendSms')}",{smstmp:smstmp,phone:phone,tmp_num:num},function(res){
                if(res.code ==0){
                    layer.alert(res.msg);
                }else{
                    layer.alert(res.data);
                }
            })
        })
    })
    })

    $("#app").click(function(){
                var html=`
                <form  action="" method="post" role="form">
                        <label for="">选择短信模板</label>
                        <select name="smsAppTmp" id="smsAppTmp" class="form-control">
                        <option value=""> -- Select One --</option>
                {foreach name="appSmsTmp" item="vo" key="k"}
            <option value="{$vo['content']}">{$vo['name']}</option>
            {/foreach}
    </select>
    </form>
    `;
    layer.open({
        btn:['推送'],
        title:'发送催款推送',
        area:['300px','300px'],
        content:html,
        yes:(function(){
            var smstmp=$("#smsAppTmp option:selected").val();
            var phone={$phone};
            $.post("{:URL('home/Sms/onlySendPush')}",{smstmp:smstmp,phone:phone},function(res){
                if(res.code ==0){
                    layer.alert(res.msg);
                }else{
                    layer.alert(res.data);
                }
            })
        })

    })
    })

    $("#voice").click(function(){
                var html=`
                <form  action="" method="post" role="form">
                        <label for="">选择语音模板</label>
                        <select name="smsVoiceTmp" id="smsVoiceTmp" class="form-control">
                        <option value=""> -- Select One --</option>
                {foreach name="smsVoiceTmp" item="vo" key="k"}
            <option value="{$vo['content']}">{$vo['name']}</option>
            {/foreach}
    </select>
    </form>
    `;
    layer.open({
        btn:['推送'],
        title:'发送催款推送',
        area:['300px','300px'],
        content:html,
        yes:(function(){
            var smstmp=$("#smsVoiceTmp option:selected").val();
            var phone={$phone};
            $.post("{:URL('home/Sms/onlySendVoice')}",{smstmp:smstmp,phone:phone},function(res){
                if(res.code ==  0){
                    layer.alert(res.msg);
                }else{
                    layer.alert(res.msg);
                }
            })
        })

    })
    })
</script>
